<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>${(topic.title)!""} - 熊猫知识库</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="${(topic.title)!""} - 甜甜圈,知识库,问答系统">
  <meta name="description" content="${(topic.title)!""} - 甜甜圈,知识库,问答系统">
  <#include "/common/header.html">

<div class="main layui-clear">
  <div class="wrap">
    <div class="content detail">
      <div class="fly-panel detail-box">
        <h1>${(topic.title)!""}</h1>
        <div class="detail-about">
          <a class="jie-user" href="/user/${(topic.creatorId)!""}.html">
          	<img src="<#if  topic.creatorAvatar?if_exists>${(topic.creatorAvatar)!""}<#else>http://img.kb.itttq.com/avatar/default.png</#if>">
          </a>
            <cite><a class="jie-user" href="/user/${(topic.creatorId)!""}.html">${(topic.creatorName)!""}</a>
            <#if topic.updateTime??>
            <em>${(topic.updateTime)?string('yyyy-MM-dd hh:mm')}</em>
            </#if>
            </cite>
          
          <div class="detail-hits" >
          	<span>
          		所属分类：<a href="/topic/${(topic.categoryId)!0}/index.html">${(topic.categoryName)!""}</a>&emsp;
          		<#if user?if_exists && user.id == topic.creatorId>
          		<span class="layui-btn layui-btn-mini jie-admin" type="edit"><a href="/topic/edit/${(topic.id)!0}.html">编辑</a></span>
          		<span class="layui-btn layui-btn-mini jie-admin" type="edit"><a href="/topic/del/${(topic.categoryId)!0}/${(topic.id)!0}.html">删除</a></span>
          		</#if>
          	</span>
          	</div>
          
          <div class="fly-list-hint">
            <i class="iconfont" title="回答">&#xe60c;</i> ${(topic.numberReply)!0}
            <i class="iconfont" title="人气">&#xe60b;</i> ${(topic.numberRead)!0}
          </div>
        </div>
        
        <div class="detail-body photos" style="margin-bottom: 20px;">${(topic.content)!""}</div>
      </div>

      <div class="fly-panel detail-box" style="padding-top: 0;">
        <a name="comment"></a>
        <ul class="jieda photos" id="jieda">
        	<#if replies?if_exists && replies?size gt 0>
        	<#list replies as item>
          <li data-id="13">
            <a name="item-121212121212"></a>
            <div class="detail-about detail-about-reply">
              <a class="jie-user" href="">
                <img src="<#if  item.creatorAvatar?if_exists>${(item.creatorAvatar)!""}<#else>http://img.kb.itttq.com/avatar/default.png</#if>">
                <cite>
                  <i>${(item.creatorName)!""}</i>
                </cite>
              </a>
              <div class="detail-hits">
                <span>${(item.updateTime)?string('yyyy-MM-dd hh:mm')}</span>
              </div>
              <#if item.isAdopt?if_exists && item.isAdopt == 1>
              <i class="iconfont icon-caina" title="最佳答案"></i>
              </#if>
            </div>
            <div class="detail-body jieda-body">${(item.content)!""}</div>
            <div class="jieda-reply">
            	<span class="jieda-zan"><a href="/reply/love/${(item.id)!0}.html?tid=${(topic.id)!0}"><i class="iconfont icon-zan"></i><em>${(item.numberLove)!0}</em></a></span>
              <div class="jieda-admin jieda-zan">
              	<#if user?if_exists && user.id == item.creatorId>
              	<span class="jieda-zan" ><a href="/reply/del/${(item.id)!0}.html?tid=${(topic.id)!0}"><i class="iconfont icon-shanchu"></i><em>删除</em></a></span>
          		</#if>
              	<#if user?if_exists && user.id == topic.creatorId && topic.categoryId == 1 && item.isAdopt != 1>
              	<!-- 问答才有采纳动作 -->
                <span class="jieda-zan"><a href="/reply/adopt/${(item.id)!0}.html?tid=${(topic.id)!0}"><i class="iconfont icon-pinglun"></i>采纳</a></span>
          		</#if>
              </div>
            </div>
          </li>
          </#list>
          <#else>
          <li class="fly-none">还没有回答哦，快来<#if user?if_exists><#else>&ensp;<a href="/login.html">登录</a>&ensp;</#if>做第一个吃螃蟹的人吧！</li>
          </#if>
        </ul>
        <#if user?if_exists>
        <div class="layui-form layui-form-pane">
          <form action="/reply/reply.html" method="post"  json-submit="false">
            <div class="layui-form-item layui-form-text">
              <div class="layui-input-block">
              	<input type="hidden" id="topicId" name="topicId" value="${(topic.id)!""}">
              	<input type="hidden" id="topicTitle" name="topicTitle" value="${(topic.title)!""}">
	            <input type="hidden" id="dirType" name="dirType"  value="3">
                <textarea id="content" name="content" required placeholder="输入回复"  class="layui-textarea fly-editor" style="height: 150px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <button class="layui-btn" lay-filter="*" lay-submit>提交回答</button>
            </div>
          </form>
        </div>
        <#elseif replies?if_exists && replies?size gt 0>
        	<ul class="jieda photos"><li class="fly-none">您还没有&ensp;<a href="/login.html">登录</a>&ensp;，暂时不能回复哦！</li></ul>
        </#if>
      </div>
    </div>
  </div>
  <div class="edge">
    <dl class="fly-panel fly-list-one"> 
      <dt class="fly-panel-title">最近热帖</dt>
		<#if mostLookTopics?if_exists && mostLookTopics?size gt 0>
		<#list mostLookTopics as item>
      <dd>
      	<a href="/topic/detail/${(item.id)!0}.html">${(item.title)!""}</a>
        <span><i class="iconfont">&#xe60b;</i> ${(item.numberRead)!0}</span>
      </dd>
      </#list>
      </#if>
    </dl>
    
    <dl class="fly-panel fly-list-one"> 
      <dt class="fly-panel-title">近期热议</dt>
		<#if mostReplyTopics?if_exists && mostReplyTopics?size gt 0>
		<#list mostReplyTopics as item>
      <dd>
      	<a href="/topic/detail/${(item.id)!0}.html">${(item.title)!""}</a>
        <span><i class="iconfont">&#xe60b;</i> ${(item.numberRead)!0}</span>
      </dd>
      </#list>
      </#if>
    </dl>
  </div>
</div>

<#assign jsFilename="index">
<#include "/common/footer.html">
</body>
</html>